/*
 * @(#)ListDmsEmailArchiveAction.java
 *
 * Copyright (c) 2006 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */

package com.dcivision.framework;

import java.io.IOException;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 AjaxAnywhereFilter
 
 This class is extends org.ajaxanywhere.AAFilter, only set the response and request Character.
 
 @author      Beyond Qu
 @company     DCIVision Limited
 @creation date   11/14/2006
 @version     $Revision: 1.2 $
 */

public class AjaxAnywhereFilter extends org.ajaxanywhere.AAFilter{	
  
  public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {   
    HttpServletRequest request = (HttpServletRequest) servletRequest;
    HttpServletResponse response = (HttpServletResponse) servletResponse;
    //help AAFilter  set the request and response Character is UTF-8 ,  
    request.setCharacterEncoding("UTF-8");
    response.setContentType("text/xml;charset=utf-8");
    
    response.setHeader("Cache-Control", "no-cache");
    response.setDateHeader("Expires", 0);
    response.setHeader("Pragma", "no-cache");
    // do AAFilter
    super.doFilter( servletRequest,servletResponse,filterChain);    
  }
}
